﻿@model IEnumerable<RedSand.Site.Models.NewsInfo>
<div class="panel">
    <div class="panel-header">
        @Html.Translate("GuideManager", "Guide", "span")
    </div>
    <div class="panel-content">
        <div class="panel-toolbar">
            <ul>
                <li>
                    @Ajax.ActionLink(Html.Translate("Create").ToHtmlString(), "create", null, AdminAjaxOptions.GetForm, new { @class = "btn-create" })
                </li>
                <li>
                    @Html.Translate("Search", "Global", "a", new { @class = "btn-search", href = "#" })
                </li>
                <li>
                    @Ajax.ActionLink(Html.Translate("DeleteList").ToHtmlString(), "delete", null, AdminAjaxOptions.DeleteRecords, new { @class = "btn-deletes" })
                </li>
            </ul>
        </div>
        <div class="panel-searchbox">
            @using (Ajax.BeginForm("List", AdminAjaxOptions.Search))
            {
                <div class="form-cell">
                    @Html.Translate("Keyword", "Global", "label")
                    @Html.TextBox("Keyword", (string)ViewBag.RouteValues.Keyword)
                </div>  
                <div class="form-cell">
                    @Html.Translate("Language", "Global", "label")
                    @Html.DropDownList("Language", DropDownListHelper.GetLanguageList((string)ViewBag.RouteValues.Language))
                </div>
                <div class="form-cell">
                    @Html.Translate("Category", "News", "label")
                    @Html.Action("GetSelectList", "Category", new { type = 1, staus = 1, selectedValue = ViewBag.RouteValues.CategoryID })
                </div>
                <div class="form-cell">
                    @Html.Translate("Status", "Global", "label")
                    @Html.DropDownList("Status", DropDownListHelper.GetStatusList(true, (byte?)ViewBag.RouteValues.Status))
                </div>
                <div class="form-cell">
                    @Html.Translate("Priority", "Global", "label")
                    @Html.DropDownList("Priority", DropDownListHelper.GetNewsHotList(true, (bool?)ViewBag.RouteValues.Priority))
                </div>
                <div class="form-cell width-auto">
                    <input type="submit" value="@Html.Translate("Search")" class="button-small" />
                </div>
                <div class="clear">
                </div>
            }
        </div>
        @if (Model == null)
        {
            @Html.Translate("DataEmpty", "Message", "div", new { @class = "message warning" })
        }
        else
        {
            <table class="table-list">
                <thead>
                    <tr>
                        <th class="center width35">
                            <input type="checkbox" />
                        </th>
                        <th>
                            @Html.Translate("Title")
                        </th>
                        <th class="center width120">
                            @Html.Translate("Category")
                        </th>
                        <th class="center width80">
                            @Html.Translate("Priority")
                        </th>
                        <th class="center width80">
                            @Html.Translate("CreateDate", "News")
                        </th>
                        <th class="center width80">
                            @Html.Translate("Status")
                        </th>
                        <th class="center width80">
                            @Html.Translate("Control")
                        </th>
                    </tr>
                </thead>
                <tbody>
                    @foreach (var item in Model)
                    {
                        <tr>
                            <td class="center">
                                <input type="checkbox" value="@item.NewsID" />
                            </td>
                            <td>
                                @Html.ActionLink(item.Title, "details", new { id = item.NewsID }, new { target = "_blank" })
                            </td>
                            <td class="center">
                                @DropDownListHelper.GetNewsTypeString(item.Type)
                            </td>
                            <td class="center">
                                @item.Priority
                            </td>
                            <td class="center">
                                @Html.DisplayFor(modelItem => item.CreateDate)
                            </td>
                            <td class="center">
                                @DropDownListHelper.GetStatusString(item.Status)
                            </td>
                            <td class="center">
                                @Ajax.ActionLink(Html.Translate("Edit").ToHtmlString(), "edit", new { id = item.NewsID }, AdminAjaxOptions.GetForm, new { @class = "btn-edit" })
                                @Ajax.ActionLink(Html.Translate("Delete").ToHtmlString(), "delete", new { id = item.NewsID }, AdminAjaxOptions.DeleteRecord, new { @class = "btn-delete" })
                            </td>
                        </tr>
                    }
                </tbody>
            </table>
            <div class="pager-wrapper">
                @Ajax.Pager((int)ViewBag.TotalRecord, AdminAjaxOptions.Paging, (object)ViewBag.RouteValues)
                <div class="pager-loading-panel">
                </div>
            </div>
        }
    </div>
</div>
